import { defineStore } from 'pinia'
import { ref } from 'vue'
export const useSettingsStore = defineStore(
  'settings',
  () => {
    const menuCollapse = ref(false)
    const layoutMode = ref('classic')

    const setMenuCollapse = (newMenuCollapse) => {
      menuCollapse.value = newMenuCollapse
    }
    const getMenuCollapse = () => {
      return menuCollapse.value
    }
    const setLayoutMode = (newLayoutMode) => {
      layoutMode.value = newLayoutMode
    }
    const getLayoutMode = () => {
      return layoutMode.value
    }
    return {
      menuCollapse,
      layoutMode,
      setMenuCollapse,
      getMenuCollapse,
      setLayoutMode,
      getLayoutMode
    }
  },
  {
    persist: {
      storage: sessionStorage // 存储方式
    }
  }
)
export default useSettingsStore
